# -*- coding: utf-8 -*-
# @Time : 2022/6/22 下午4:46
# @Author : wyf
# @FileName: login.py
# @Email: yunfei.wang@innvote.com
"""

万博体育登录
https://cn.fawmx.com/home/register
"""
import os
import time

import requests

from selenium import webdriver
from selenium.webdriver.common.by import By

PRO_DIR = os.path.dirname(os.path.abspath(__file__))


def driver_sig(html_file):
    options = webdriver.ChromeOptions()
    options.add_argument("-headless")  # 不显示浏览器
    user_ag = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'
    options.add_argument('user-agent=%s' % user_ag)
    driver = webdriver.Chrome(options=options)
    driver.get("file:///" + os.path.join(PRO_DIR, html_file))
    sig = driver.find_element(by=By.ID, value='eeBlackBox')
    print(sig.text)
    return sig.text


eeBlackBox = driver_sig('bb_data.html')

#
# reqs = requests.get("https://cn.fawmx.com/service/verifycode?x=0.6781314464280672")
# reqs.encoding = 'utf-8'
# # # data_utf8 = data.encode('utf-8')
# print(reqs.content)
# # data_utf8 = reqs.content.encode('utf-8')
#
# with open("12.png", "wb") as img:
#     img.write(reqs.content)


# url = "https://cn.fawmx.com/home/register"
# req = requests.get(url)
# print(req.text)
